Use pointer integer types for comparisons
authorDanny Robson <danny@blubinc.net>
Sun, 19 Jul 2009 09:24:54 +0000 (19:24 +1000)
committerMartin Nordholts <martinn@src.gnome.org>
Sun, 19 Jul 2009 11:24:45 +0000 (13:24 +0200)
Convert all occurences of pointer arithmetic using integral types to use
the standard ptrdiff_t and intptr_t types. Fixes some build warnings.

babl/babl-fish.c
babl/babl-memory.c
extensions/sse-fixups.c

index 0ab048c48a86fc5faabe5ca7ad984bf65ba52e4f..622ca25737c14315794045934242872d4aa76180 100644 (file)
@@ -18,6 +18,7 @@
 
 #include "config.h"
 #include "babl-internal.h"
+#include <stddef.h>
 #include <string.h>
 #include <stdarg.h>
 
@@ -137,7 +138,7 @@ babl_fish_get_id (const Babl *source,
   /* value of 'id' will be used as argument for hash function,
    * substraction serves as simple combination of
    * source/destination values. */
-  int id = (int) source - (int) destination;
+  ptrdiff_t id = source - destination;
   /* instances with id 0 won't be inserted into database */
   if (id == 0)
     id = 1;
index ea6e65d8857a72c32df36441c0126408eb461a09..3a8f34fff5d0c383a13896646de3087f944c2856 100644 (file)
@@ -17,6 +17,7 @@
  */
 
 #include "config.h"
+#include <stdint.h>
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
@@ -106,7 +107,7 @@ babl_malloc (size_t size)
   if (!ret)
     babl_fatal ("args=(%i): failed", size);
 
-  offset = BABL_ALIGN - ((unsigned int) ret + BABL_ALLOC) % BABL_ALIGN;
+  offset = BABL_ALIGN - ((uintptr_t) ret + BABL_ALLOC) % BABL_ALIGN;
   ret = ret + BABL_ALLOC + offset;
 
   *((void **) ret - 1) = ret - BABL_ALLOC - offset;
index 1866556e11eb6470583becec9c608e1b972a45cd..96c2585e1c57d6cd4430e54ff2c88b1c205072a7 100644 (file)
@@ -23,6 +23,7 @@
 
 #if defined(__GNUC__) && (__GNUC__ >= 4) && defined(USE_SSE) && defined(USE_MMX)
 
+#include <stdint.h>
 #include <stdlib.h>
 
 #include "babl.h"
@@ -53,7 +54,7 @@ conv_rgbaF_linear_rgb8_linear (unsigned char *src,
 {
   long n = samples;
 
-  if ((int) src & 0xF)
+  if ((intptr_t) src & 0xF)
     {
       // nonaligned buffers, we have to use fallback x87 code
       float *fsrc = (float *) src;
@@ -110,7 +111,7 @@ conv_rgbaF_linear_rgba8_linear (unsigned char *src,
                                 long           samples)
 {
   long n = samples;
-  if ((int) src & 0xF)
+  if ((intptr_t) src & 0xF)
     {
       // nonaligned buffers, we have to use fallback x87 code
       float *fsrc = (float *) src;